import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home',
    component: () => import('@/views/layout'),
    children: [
      { path: 'home', component: () => import('@/views/layout/home') },
      { path: 'qs', component: () => import('@/views/layout/qs') },
      { path: 'vdeio', component: () => import('@/views/layout/vdeio') },
      { path: 'my', component: () => import('@/views/layout/my') }
    ]
  },
  { path: '/login', component: () => import('@/views/login') },
  { path: '/search', component: () => import('@/views/search') },
  // 这个只是一个测试的路径
  { path: '/test', component: () => import('@/test.vue') },

  //js跳转？？  路由解耦的跳转
  {
    path: '/article/:articleId',
    name: 'article',
    component: () => import('@/views/layout/home/components/detailArticle.vue'),
    props: true    //为了方便$router.的写法
  },
  {
    path: '/user/profile',
    name: 'userprofile',
    component: () => import('@/views/user-profile'),
    props: true    //为了方便$router.的写法
  },
]

const router = new VueRouter({
  routes
})

export default router
